package car

const carType1 = "自行车"
const carType2 = "汽车"

type  CarImp  struct {
	speed   int
	price   int
	brand   string
	carType int //自行车1 汽车2
}

func NewCar(speed int, price  int, brand string, carType int) *CarImp {
	self := new(CarImp)
	self.speed = speed
	self.price = price
	self.brand = brand
	self.carType = carType
	return self
}

func (self *CarImp)Run(i int) {
	println("第",i,"辆",typeEcho(self.carType), "正在跑...")
}

func (self *CarImp)Stop() {
	println(typeEcho(self.carType), "停下来了...")
}
func typeEcho(carType int) string {
	var carTypeName string
	if (carType == 1) {
		carTypeName = carType1
	} else if (carType == 2) {
		carTypeName = carType2
	} else {
		carTypeName = "未知车辆"
	}
	return carTypeName
}